import time


def logger(msg):
    def time_master(func):
        def call_func():
            start = time.time()
            func()
            stop = time.time()
            print(f"[{msg}]一共耗费了{(stop - start):.2f}秒。")

        return call_func

    return time_master


@logger(msg="方法a")
def fun_a():
    time.sleep(1)
    print("正在调用func_a...")


@logger(msg="方法b")
def fun_b():
    time.sleep(1)
    print("正在调用func_b...")


fun_a()
fun_b()
